﻿using System;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;

namespace AnyOffice.general.address.public1
{
    public partial class address_detail : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                int addressId = (Request.QueryString["address_id"] == null) ? 0 : int.Parse(Request.QueryString["address_id"].ToString());
                this.ViewState["AddressId"] = addressId;
                DataTable table = new AddressDao().SelectByAddressId(base.Conn, addressId, "");
                if (table.Rows.Count > 0)
                {
                    this.litNavPromat.Text = (table.Rows[0]["Name"] != DBNull.Value) ? table.Rows[0]["Name"].ToString() : "";
                    this.litName.Text = (table.Rows[0]["Name"] != DBNull.Value) ? table.Rows[0]["Name"].ToString() : "";
                    //this.litSex.Text = Convert.ToBoolean(table.Rows[0]["Sex"].ToString()) ? "男" : "女";
                    //this.litBirthday.Text = (table.Rows[0]["Birthday"] != DBNull.Value) ? table.Rows[0]["Birthday"].ToString() : "";
                    //this.litNickName.Text = (table.Rows[0]["NickName"] != DBNull.Value) ? table.Rows[0]["NickName"].ToString() : "";
                    this.litMinistration.Text = (table.Rows[0]["Ministration"] != DBNull.Value) ? table.Rows[0]["Ministration"].ToString() : "";
                    //this.litMate.Text = (table.Rows[0]["Mate"] != DBNull.Value) ? table.Rows[0]["Mate"].ToString() : "";
                    //this.litChild.Text = (table.Rows[0]["Child"] != DBNull.Value) ? table.Rows[0]["Child"].ToString() : "";
                    this.litDeptName.Text = (table.Rows[0]["DeptName"] != DBNull.Value) ? table.Rows[0]["DeptName"].ToString() : "";
                    this.litDeptAddr.Text = (table.Rows[0]["DeptAddr"] != DBNull.Value) ? table.Rows[0]["DeptAddr"].ToString() : "";
                    //this.litDeptPost.Text = (table.Rows[0]["DeptPost"] != DBNull.Value) ? table.Rows[0]["DeptPost"].ToString() : "";
                    this.litDeptTel.Text = (table.Rows[0]["DeptTel"] != DBNull.Value) ? table.Rows[0]["DeptTel"].ToString() : "";
                    this.litDeptFax.Text = (table.Rows[0]["DeptFax"] != DBNull.Value) ? table.Rows[0]["DeptFax"].ToString() : "";
                    //this.litHomeAddr.Text = (table.Rows[0]["HomeAddr"] != DBNull.Value) ? table.Rows[0]["HomeAddr"].ToString() : "";
                    //this.litHomePost.Text = (table.Rows[0]["HomePost"] != DBNull.Value) ? table.Rows[0]["HomePost"].ToString() : "";
                    //this.litHomeTel.Text = (table.Rows[0]["HomeTel"] != DBNull.Value) ? table.Rows[0]["HomeTel"].ToString() : "";
                    this.ViewState["mobile"] = (table.Rows[0]["Mobile"] != DBNull.Value) ? table.Rows[0]["Mobile"].ToString() : "";
                    //this.litBp.Text = (table.Rows[0]["Bp"] != DBNull.Value) ? table.Rows[0]["Bp"].ToString() : "";
                    //this.litEmail.Text = (table.Rows[0]["Email"] != DBNull.Value) ? table.Rows[0]["Email"].ToString() : "";
                    //this.litOicq.Text = (table.Rows[0]["Oicq"] != DBNull.Value) ? table.Rows[0]["Oicq"].ToString() : "";
                    //this.litMsn.Text = (table.Rows[0]["Msn"] != DBNull.Value) ? table.Rows[0]["Msn"].ToString() : "";
                    if (table.Rows[0]["Note"] != DBNull.Value)
                    {
                        this.litNote.Text = table.Rows[0]["Note"].ToString().Replace("\r\n", "<br>");
                    }
                }
                else
                {
                    Response.Write(base.ShowMessage("无此联系人"));
                    Response.End();
                }
            }
        }


    }
}
